import sys
import argparse
import os
from yolo import yolo, detect_video
from PIL import Image

def detect_img(img_path):
    #while True:
    # xml_path = 'F:/vehicle-detection/Annotations/xmls/'

    image = Image.open(img_path)
    # xmlpath=os.path.join(xml_path,xmlname)
    # if not os.path.exists(xmlpath):
    print(image.filename.split('\\')[-1])
    r_image,r_image_crop = yolo.detect_image(image)
    #r_image.show()
    #yolo.close_session()
    
    return r_image_crop

FLAGS = None

if __name__ == '__main__':
    print("Image detection mode")
    detect_img(r'E:\vmware\models-master\research\slim\keras-yolov3-master\images\in')